package org.boz.dial;

// From: http://java.sun.com/developer/technicalArticles/ALT/Reflection/
//   public class constructor2 {
//       public constructor2()
//       {
//       }

//       public constructor2(int a, int b)
//       {
//          System.out.println(
//            "a = " + a + " b = " + b);
//       }

//       public static void main(String args[])
//       {
//          try {
//            Class cls = Class.forName("constructor2");
//            Class partypes[] = new Class[2];
//             partypes[0] = Integer.TYPE;
//             partypes[1] = Integer.TYPE;
//             Constructor ct 
//               = cls.getConstructor(partypes);
//             Object arglist[] = new Object[2];
//             arglist[0] = new Integer(37);
//             arglist[1] = new Integer(47);
//             Object retobj = ct.newInstance(arglist);
//          }
//          catch (Throwable e) {
//             System.err.println(e);
//          }
//       }
//    }

public class LispJavaObject extends LispObject {
	private Object m_value;

	public LispJavaObject(Object value) {
		m_value = value;
	}

	public Object value() {
		return m_value;
	}

	public boolean equals(Object o) {
		System.out.println("LispJavObject::equals. this = " + this
				+ ", other = " + o);
		if (o instanceof LispJavaObject) {
			return ((LispJavaObject) o).m_value.equals(m_value);
		}
		return false;
	}

	public Object toObject() {
		return m_value;
	}

	public String toString() {
		return "<#JAVAOBJ [" + m_value.getClass().getName() + "]: "
				+ m_value.hashCode() + ">";
	}

	public LispObject eval(LispObject env) {
		return this;
	}
}
